#pragma once
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>

#include <math.h>
using namespace std;
#define ANGLE2RAD(d) (d * 0.0174533)
class Node
{
public:
	//node name
	//int nodeType;
	map<string, Node> ToNome;
	//vector<Node> endNode;
	vector<Node*> endNode;
	//状态
	int attr;
	double F = 1000.0;
	bool isInPaths=false;
	double G = 0.0; //实际长度
	double H = 0.0; //估算长度
	int post[2] = {0};
	int parent = 0xffff;
	double ViewRGB[3]={0.0,0.0,0.0};

	string roadpointname;
	string  roadpointtype;
	int  osm_id2;
	int  osm_id2_2;
	string geometry_type;
	string line_osm_id;
	double longitude;
	double latitude;
	size_t index;


	//double distance(Node *pendNode)
	//{
	//	return GetDistance(pendNode);
	//	//	float distance2 = pow((this->longitude - pendNode->longitude), 2) + pow(this->latitude - pendNode->latitude, 2);
	//	//return pow(distance2, 0.5);
	//}
	double calZDis(Node endNode)
	{
		float distance2 = fabs((this->longitude - endNode.longitude)) + fabs(this->latitude - endNode.latitude);
		return distance2;
	}
	double GetDistance(Node* pendNode) {
			double lat1 = this->latitude;
			double long1 = this->longitude;
			double lat2 = pendNode->latitude;
			double long2 = pendNode->longitude;
			return 6378137 * acos(sin(lat1 * 0.01745329) * sin(lat2 * 0.01745329) + cos(lat1 * 0.01745329) * cos(lat2 * 0.01745329) * cos((long1 - long2) * 0.01745329));
	}

	void print(string str)
	{

		printf("%s,(%.8f,%.8f),now %ld :,",str.c_str(), longitude, latitude,index);
	

		printf("osmid(%d,%d),pid %d:  ", osm_id2, osm_id2_2, parent);

		for (int i = 0; i < endNode.size(); i++)
		{
			//printf("%d ", endNode[i].index);
			printf("%d ", endNode[i]->index);
		}
		cout <<" end"<< endl; //输出vector中的内容


		//cout << "*** name:" << nodeType << " **** " << str << endl;
		printf("   F=%.8f,G=%.8f,H=%.8f %d\r\n",  F, G, H, attr);
		

		//cout << "index:" << index << endl;
		//cout << "***" << endl;
	}



};
